package com.lijiaxing.controller;

import com.lijiaxing.pojo.Result;
import com.lijiaxing.service.userService;
import jakarta.validation.constraints.Pattern;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Validated
@RestController
@RequestMapping("/")
public class loginController {
    @Autowired
    private userService us;

    @PostMapping("login")
    public Result login(@RequestParam("userName") @Pattern(regexp = "^1[0-9]{10}$") String utl, @RequestParam("passWord") @Pattern(regexp = "^[0-9a-zA-Z._]{6,}") String upwd) {
        return us.login(utl, upwd);
    }
}
